package com.alibaba.dingtalk.openapi.newmessage.delivery;/*/*/

import com.alibaba.dingtalk.openapi.exception.ApiRuleException;
import com.alibaba.dingtalk.openapi.newmessage.utils.DeliveryCheckUtils;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 查询工作通知消息的发送结果
 * @author 魏荣杰
 * @date 2019/3/21 20:31
 * @since v1.0
 * @version v1.0
 */
@Setter
@Getter
@ToString
public class CorpConversationSendResultMsgDelivery extends AbstractDelivery {
    private static final long serialVersionUID = -6431655051432120641L;

    /**
     * 微应用的agentid
     */
    private Long agentId;

    /**
     * 异步任务的id
     */
    private Long taskId;


    @Override
    public JSONObject toJsonObject() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("agent_id", this.agentId);
        jsonObject.put("task_id", this.taskId);
        return jsonObject;
    }

    @Override
    public void check() throws ApiRuleException {
        DeliveryCheckUtils.checkNotEmpty(this.agentId, "agentId");
        DeliveryCheckUtils.checkNotEmpty(this.taskId, "taskId");
    }
}
